/*
 *  $TEAM_NAME Space Trader
 */
package models;

/**
 * Represents a fuel tank on a ship
 * @author bradley
 * @version 1.0
 */

public class FuelTank {
	/**
	 * field
	 */
	private int maxFuel;
	
	/**
	 * field
	 */
	private int currentFuel;
	
	/**
	 * no arg constructor
	 */
	public FuelTank(){
		this.maxFuel = 0;
	}
	
	/**
	 * Default constructor for a fuel tank
	 * @param maxFuel - the maximum fuel the fuel tank can hold
	 */
	public FuelTank(int maxFuel) {
		this.maxFuel = maxFuel;
		this.currentFuel = this.maxFuel;
	}
	
	/**
	 * Fills the current fuel to the maximum amount, and 
	 * calculates how much fuel that took.
	 * @return int - the number of units of fuel used
	 */
	public int fillTank() {
		final int temp = this.maxFuel - this.currentFuel;
		this.currentFuel = this.maxFuel;

		return temp;
	}

    /**
     * Gets the maximum amount of fuel the ship has
     * @return the max amount of fuel
     */
    public int getMaxFuel() {
        return maxFuel;
    }

    /**
     * Gets the current amount of fuel
     * @return the current amount of fuel
     */
    public int getCurrentFuel() {
        return currentFuel;
    }
    
    /**
     * Uses fuel units
     * @param units - the amount used
     */
    public void useFuel(int units) {
    	this.currentFuel -= units;
    }

    /**
     * Calculates the percentage of fuel remaining
     * @return double - the fuel percentage
     */
    public double getFuelLevel() {
        return ((double) this.currentFuel) / this.maxFuel;
    }

    /**
     * Sets the max fuel
     * @param maxFuel
     */
	public void setMaxFuel(int maxFuel) {
		this.maxFuel = maxFuel;
	}

	/**
	 * Sets the current fuel
	 * @param currentFuel
	 */
	public void setCurrentFuel(int currentFuel) {
		this.currentFuel = currentFuel;
	}
	
	/**
	 * to string
	 * @return string
	 */
	public String toString() {
		return "";
	}
}
